package com.ktjy.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ktjy.pojo.AppCategory;
import com.ktjy.service.AppCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/cate")
public class AppCategoryController {
    @Autowired
    AppCategoryService appCategoryService;

    @RequestMapping(value = "/updateJson",produces = "application/json;charset=utf-8")
    @ResponseBody
    public Object updateJson(HttpServletRequest request , @RequestParam("pid") Integer pid){
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("parentId",pid);

        List<AppCategory> appCategories = appCategoryService.selectType(queryWrapper);

        return appCategories;
    }
}
